#include <iostream>//Shape.cpp
#include <math.h>
#include "Shape.h"

using namespace std;

double Shape::getArea(){return 0;}

void Shape::printArea()
{
    cout<<"Area: "<<getArea()<<endl;
}

Triangle::Triangle(double _a,double _b,double _c)
:a(_a),b(_b),c(_c){}

Square::Square(double len):length(len){}

Circle::Circle(double rad):radius(rad){}

Rectangle::Rectangle(double wid,double hei):width(wid),height(hei){}

Trapezoid::Trapezoid(double top,double bot,double hei)
:toplength(top),bottomlength(bot),height(hei){}

double Triangle::getArea()
{
    double p = (a + b + c) / 2;
    return sqrt(p*(p - a)*(p - b)*(p - c));
}

double Square::getArea()
{
    return length*length;
}

double Circle::getArea()
{
    return 3.1415*radius*radius;
}

double Rectangle::getArea()
{
    return width*height;
}

double Trapezoid::getArea()
{
    return (toplength + bottomlength)*height / 2;
}
